package test3.A1_2;
import java.util.ArrayList;
import java.util.List;

// College类
class College {
    private List<Building> buildings; // 聚合，学院包含多个建筑
    private List<Course> courses; // 组合，学院包含多个课程

    public College() {
        this.buildings = new ArrayList<>();
        this.courses = new ArrayList<>();
    }

    // 添加建筑
    public void addBuilding(Building building) {
        buildings.add(building);
    }

    // 添加课程
    public void addCourse(Course course) {
        courses.add(course);
    }

    public List<Building> getBuildings() {
        return buildings;
    }

    public List<Course> getCourses() {
        return courses;
    }

    @Override
    public String toString() {
        return "College{" +
                "buildings=" + buildings +
                ", courses=" + courses +
                '}';
    }
}

